// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "Unlit/CameraShader"
{
	Properties
	{
		_MainTex ("Texture", 2D) = "white" {}
        _ColorChangeY("ColorChangeY",Range(0,1))=0
	}
	SubShader
	{
		Tags 
		{
			"RenderType"="Transparent" 
			"Queue"="Transparent" 
		}
		LOD 200

		Cull Off

		Lighting Off

		Pass
		{
			CGPROGRAM
			
			#pragma vertex vert
            #pragma fragment frag
            
            #include "UnityCG.cginc"

			sampler2D _MainTex;
            float _ColorChangeY;

			  struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };


			v2f vert (appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = v.uv;
				return o;
			}

			fixed4 frag (v2f i) : SV_Target
			{         
				fixed4 mainCol= tex2D(_MainTex, i.uv);
				if(i.uv.x<_ColorChangeY)
				{
					float r=mainCol.g;
					mainCol.g=(1-mainCol.b)*0.5f;
				    mainCol.b=(1-mainCol.r)*0.5f;
				    mainCol.r=(1-r)*0.5;
				}
				return mainCol ;
			}

			ENDCG
		}
	}
}